package com.cskaoyan._01btyestream;

import java.io.*;

/**
 * @description:
 * @author: 景天
 * @date: 2023/2/18 9:38
 **/

public class Temp {
    public static void main(String[] args)throws IOException {
        FileInputStream in = new FileInputStream("a.txt");
        FileOutputStream out1 = new FileOutputStream("b.txt");
        FileOutputStream out2 = new FileOutputStream("c.txt");
        copyFile(in , out1);
        copyFile(in , out2);
        in.close();
        out1.close();
        out2.close();
    }


    public static void copyFile(InputStream in, OutputStream out) throws IOException{
        int readCount;
        byte[] bytes = new byte[1024];
        while((readCount = in.read(bytes)) !=-1){
            out.write(bytes,0,readCount);
        }
    }
}
